package graph_viewer.util;

import java.awt.*;
import javax.swing.*;

import graph_viewer.structure.*;

public class Animator_Util{
	static public void clear_range( JComponent animation_board ){
		animation_board.paintImmediately( animation_board.getX(), animation_board.getY(), animation_board.getWidth(), animation_board.getHeight() );
	}
	
	static public void clear_range( JComponent animation_board, Node_Position a_np ){
		int[] location	= a_np.find_location();
		animation_board.paintImmediately( location[0] -1 , location[1] -1, a_np.get_width() + 2, a_np.get_height() + 2 );
	}
	

	static public void pause( double seconds ){	
		int mag_factor	 = 10000000;

		for ( int i = 0 ; i < seconds * mag_factor; i++){}
	}

	//@return true if a_point is above another_point
	static public boolean is_above( Point a_point, Point another_point ){
		return a_point.getY() < another_point.getY();
	}

	static public boolean is_below( Point a_point, Point another_point ){
		return a_point.getY() > another_point.getY();
	}

	static public boolean is_right( Point a_point, Point another_point ){
		return a_point.getX() > another_point.getX();
	}

	static public boolean is_left( Point a_point, Point another_point ){
		return a_point.getX() < another_point.getX();
	}

	static public boolean is_x_align( Point a_point, Point another_point ){
		return a_point.getY()  == another_point.getY();
	}

	static public boolean is_y_align( Point a_point, Point another_point ){
		return a_point.getX()  == another_point.getX();
	}
}
